package com.bandit;

import com.bandit.config.RpcServiceConfig;
import com.bandit.proxy.RpcClientProxy;
import com.bandit.remoting.transport.netty.client.RpcNettyClient;
import com.bandit.service.UserService;

/**
 * @author Bandit
 * @create 2022/2/27 18:48
 */
public class NettyClientMain {
    public static void main(String[] args) throws InterruptedException {
        RpcNettyClient client = new RpcNettyClient();
        RpcServiceConfig rpcServiceConfig = new RpcServiceConfig();
        rpcServiceConfig.setVersion("1.0");
        RpcClientProxy rpcClientProxy = new RpcClientProxy(client, rpcServiceConfig);
        UserService userService = rpcClientProxy.getProxy(UserService.class);
        for (int i = 0; i < 5; i++) {
            Thread.sleep(1000);
            System.out.println(userService.getUserById(1));
        }
        Thread.sleep(5000);

    }
}
